package com.example.demo.pojo.dto;

import com.example.demo.enumeration.Campus;
import com.example.demo.enumeration.ItemCategory;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;

import java.math.BigDecimal;
import java.util.List;

@Getter
@Setter
@ToString
public class AddItemDTO {
    @NotBlank(message = "商品名称不能为空")
    @Length(min = 1, max = 40, message = "名称长度限定为1-40个字符")
    private String name;

    @NotNull(message = "商品价格不能为空")
    @Digits(integer = 5, fraction = 2, message = "商品价格整数部分限制为5位，小数部分限制为2位")
    private BigDecimal price;

    @NotBlank(message = "商品描述不能为空")
    private String description;

    @NotNull(message = "商品类别不能为空")
    private ItemCategory category;

    @NotNull(message = "商品校区不能为空")
    private List<Campus> campuses;

    @NotNull(message = "图片列表不能为空")
    @Size(max = 9)
    private List<@URL String> images; //图片url列表

    public AddItemDTO() {
    }

    public AddItemDTO(String name, BigDecimal price, String description, ItemCategory category, List<Campus> campuses, List<@URL String> images) {
        this.name = name;
        this.price = price;
        this.description = description;
        this.category = category;
        this.campuses = campuses;
        this.images = images;
    }
}
